@echo off

set ToolPath=%CD%
set ServerResPath=%ToolPath%\..\..\game-hot-fix

C:\CocosDashboard\resources\.editors\Creator\2.4.8\CocosCreator.exe --path %ToolPath%\.. --build "platform=android;startScene=2d2f792f-a40c-49bb-a189-ed176a246e49;inlineSpriteFrames=false;optimizeHotUpdate=false;template=default;packageName=com.puzzlegames.jigsaw.puzzles.free;useDebugKeystore=true;encryptJs=true;xxteaKey=2b71bc91-4a06-4b;zipCompressJs=true;md5Cache=false;debug=true;sourceMaps=true;"

cd %ToolPath%
start /wait Update_RemoteRes.bat debug

cd %ToolPath%\..
for /f "delims=" %%i in ("%cd%") do set folder=%%~ni

cd %ToolPath%
if exist %ServerResPath%\%folder% (
    goto :domain
) else (
    echo %ServerResPath%\%folder% is not exist!
    pause
    goto :mainend
)

:domain
cd %ServerResPath%
git reset
git checkout
git pull
echo %ServerResPath%\%folder%\debug
rd %ServerResPath%\%folder%\debug /s /q
md %ServerResPath%\%folder%\debug
echo d|xcopy %ToolPath%\RemoteRes\debug %ServerResPath%\%folder%\debug /s/e/y

git add .
git commit -m "Update Server RemoteRes"
git push

:mainend
exit